#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<sys/wait.h>


int main()
{
	putenv("aaa=1000");
	pid_t id = fork();
	if(id == 0)
	{
		printf("before exec,pid =%d\n",getpid());
	//	execl("/usr/bin/ls","ls","-a","-l",NULL);
   //execlp("ls","ls","-a","-l",NULL);
		char*const argv[] = {
			"ls","-a","-l",NULL
		};
		char*const myenv[] = {
			"liu=1","deng=2","jian=3",NULL
		};
		extern char**environ;
        execle("./code","code",NULL,myenv);
		printf("after exec\n");
		exit(0);
	}
	else
	{
		pid_t ret = wait(NULL);
		if(ret == id )
		{
			printf("parent pid :%d ,   childpid = %d\n",getpid(),ret);
		}

	}
	return 0;
}
